import 'package:flutter/services.dart';
import 'package:get/get.dart';

import '../../bridge/bridge.dart';
import 'setting_state.dart';

class SettingLogic extends GetxController {
  final SettingState state = SettingState();

  @override
  void onReady() {
    FlutterBridge.getInstance().register(FlutterBridge.METHOD_NAME_AND_TO_FLT, (MethodCall call) {
      print('receive Native message arguments=${call.arguments}  method=${call.method}');
      return Future.value('from flutter message ${DateTime.now().toString()}');
    });
    super.onReady();
  }

  @override
  void onClose() {
    FlutterBridge.getInstance().unRegister(FlutterBridge.METHOD_NAME_AND_TO_FLT);
    super.onClose();
  }
}
